{% extends "base.html" %}
{% block title %}{{page_title}}{% endblock %}
{% block nav_home_active %}active{% endblock %}

{% block content %}
<div class="container">
    <div class="row">
        <div class="col-sm-4 col-sm-offset-4">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">{{form_title}}</h3>
                </div>
                <form action="" method="POST">
                    {% csrf_token %}
                    <div class="panel-body">
                        {% for field in form %}
                        <div class="form-group">
                            {% if not field.is_hidden %}
                            <label for="{{ field.id_for_label }}">
                                {{ field.label }}
                            </label>
                            {% endif %}
                            {{ field }}
                            <p class="text-danger">
                                {{ field.errors.as_text }}
                            </p>
                        </div>
                        {% endfor %}
                        <span id="tip" class="text-danger">
                            {{form.non_field_errors.as_text }}
                        </span>
                        <div class="clearfix"></div>
                        <div class="pull-left">
                            {% block other_buttons %}{% endblock %}
                        </div>
                    </div>
                    <div class="panel-body">
                        <button type="submit" class="btn btn-primary pull-right">{{submit_text}}</button>
                        <button type="button" class="btn btn-default pull-left"
                                onclick="window.location.href='{{return_back_url}}'">返回</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
